package com.usian.controller;

import com.usian.pojo.SearchItem;
import com.usian.service.SearchItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class SearchItemController {

    @Autowired
    private SearchItemService searchItemService;

    @RequestMapping("importAll")
    boolean importAll(){
      return searchItemService.importAll();
    };

    @RequestMapping("list")
    List<SearchItem> searchByQ(@RequestParam String q, @RequestParam Integer page, @RequestParam Integer pageSize){
        return searchItemService.searchByQ(q,page,pageSize);
    }

}
